#include <sys/wait.h>
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
using namespace std;
int main(){
	int status;//用于存子进程返回的状态
	pid_t pid=fork();
	if(pid==0){
	  return 3;
	}
	else{
	  cout<<"Child PID:"<<pid<<endl;
	  pid=fork();
	  if(pid==0){
 	    exit(17);
	  }
	  else{
	    cout<<"Child PID:"<<pid<<endl;
	    wait(&status);
	    if(WIFEXITED(status))
	      cout<<"Child send one:"<<WEXITSTATUS(status)<<endl;
	    wait(&status);
	    if(WIFEXITED(status))
	      cout<<"Chile send two:"<<WEXITSTATUS(status)<<endl;
	    sleep(30);
	  }
	}
	return 0;
}
